<?php
if($this->session->userdata['user_login']){?>

<?php $this->load->view('admin/header_layout'); ?>

<div class="content-inner">
    <div class="marg20-btm">
        <a href="<?php echo site_url('admin/dashboard/user'); ?>" class="btn btn-primary">&hearts; View Members </a>
    </div>
    <?php
	echo form_open('admin/dashboard/add_user', 'class="form-horizontal"');
    $firstname = array(
        'name' => 'fname',
        'value' => set_value('firstname'),
        'id' => 'input01',
        'required' => '',
        'placeholder' => 'Your firstname ',
        'class' => 'input-xlarge'
    );
    $lastname = array(
        'name' => 'lastname',
        'value' => set_value('lastname'),
        'id' => 'input01',
        'required' => '',
        'placeholder' => 'Your lastname',
        'class' => 'input-xlarge'
    );
    $username = array(
        'name' => 'username',
        'value' => set_value('username'),
        'id' => 'input01',
        'required' => '',
        'placeholder' => 'Your username ',
        'class' => 'input-xlarge'
    );
    $password = array(
        'name' => 'pass',
        'value' => '',
        'id' => 'input01',
        'required' => '',
        'placeholder' => 'Your password',
        'class' => 'input-xlarge',
        'type' => 'password'
    );
    $confirm_pass = array(
        'name' => 'conf_pass',
        'id' => 'input01',
        'required' => '',
        'class' => 'input-xlarge',
        'placeholder' => 'Retype password',
        'required' => '',
        'type' => 'password'
    );
    $email = array(
        'name' => 'email',
        'value' => set_value('email'),
        'id' => 'input01',
        'placeholder' => 'Your email',
        'required' => '',
        'type' => 'email'
    );
    $gender = array(
        '' => '---select gender---',
        'Male' => 'Male',
        'Female' => 'Female',
        'Other' => 'Other'
    );
    $role = array(
        '' => '---select role---',
        '1' => 'Administrator',
        '2' => 'Simple User'
    );
    $nationality = array(
        'name' => 'nationality',
        'id' => 'input01',
        'class' => 'input-xlarge',
        'required' => '',
        'placeholder' => 'Your Nationality',
        'required' => '',
        'value' => set_value('user_nationality')
    );
    $address = array(
        'name' => 'address',
        'id' => 'input01',
        'class' => 'input-xlarge',
        'placeholder' => 'Your address',
        'required' => '',
        'value' => set_value('user_add'),
        'rows' => '5',
        'cols' => '10',
        'style' => 'width:30%'
    );
    ?>

    <div class="control-group">

        <?php
        echo '<div class="controls">
		   <span style="color:red; margin-left:12px;">' . validation_errors('&times;') . '</span>
		   </div>';
        ?>
        <div class="control-group">
            <label class="control-label" for="input01">First Name </label>
            <div class="controls">
                <?php echo form_input($firstname); ?>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="input01">Sure Name </label>
            <div class="controls">
                <?php echo form_input($lastname); ?>
            </div>
        </div>
        <label class="control-label" for="input01">UserName </label>
        <div class="controls">
            <?php echo form_input($username); ?>
        </div>
    </div>

    <div class="control-group">
        <label class="control-label" for="input01">Password </label>
        <div class="controls">
            <?php echo form_password($password); ?>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="input01">Confirm Password </label>
        <div class="controls">
            <?php echo form_password($confirm_pass); ?>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="input01">Emial Active </label>
        <div class="controls">
            <?php echo form_input($email); ?>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="input01">Nationality </label>
        <div class="controls">
            <?php echo form_input($nationality); ?>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="input01">Gender </label>
        <div class="controls">
            <?php echo form_dropdown('gender', $gender); ?>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="input01">User Role </label>
        <div class="controls">
            <?php echo form_dropdown('role', $role); ?>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="input01">Address </label>
        <div class="controls">
            <?php echo form_textarea($address); ?>
        </div>
    </div>
    <div class="form-actions">
		<?php
			echo form_submit('btn_submit', 'Save', 'class="btn btn-primary"');
		?>
        <a href="./user.html" class="btn">Cancel </a>
    </div>
</form> 
<?php
}else{
	redirect(base_url());
}
?>